<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="Bookmark" href="__EXTEND__/favicon.ico" >
    <link rel="Shortcut Icon" href="__EXTEND__/favicon.ico" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="__EXTEND__/lib/html5shiv.js"></script>
    <script type="text/javascript" src="__EXTEND__/lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="__EXTEND__/static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="__EXTEND__/static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="__EXTEND__/lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="__EXTEND__/static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="__EXTEND__/static/h-ui.admin/css/style.css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="__EXTEND__/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title>系统配置</title>
    <link href="__EXTEND__/lib/lightbox2/2.8.1/css/lightbox.css" rel="st ylesheet" type="text/css" >
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> <a style='color:#F37B1D' href="{{:U('Admin/Index/welcome')}}">首页</a> <span class="c-gray en">&gt;</span> 系统管理 <span class="c-gray en">&gt;</span> 系统配置
    <a class="btn btn-default radius r " id="btn-refresh" style="line-height:1.6em;margin-top:3px" href="{{:U('Admin/System/config')}}" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
     <form class="form form-horizontal" id="form-edit">
         <div class="row cl">
             <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>注册奖励(体验金)：</label>
             <div class="formControls col-xs-8 col-sm-8">
                 <span style="display:block">
                     <input type="text" class="input-text" onblur="checkPrice(this,'注册奖励(体验金)',1)" style="width:400px;" value="{{$shop_config['experience_money']}}" placeholder="请输入注册奖励(体验金)" id="experience_money" name="experience_money">元
                     <span display="none" style="color:red"  class="show_info"></span>
                 </span>
                 <label  style="padding-left:0; color:#B3B3B3;display:block">注册奖励(体验金)</label>
             </div>
         </div>
         <div class="row cl">
             <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>邀请奖励(体验金)：</label>
             <div class="formControls col-xs-8 col-sm-8">
                 <span style="display:block">
                     <input type="text" class="input-text" onblur="checkPrice(this,'邀请奖励(体验金)',1)" style="width:400px;" value="{{$shop_config['invite_award_money']}}" placeholder="请输入注册奖励(体验金)" id="invite_award_money" name="invite_award_money">元
                     <span display="none" style="color:red"  class="show_info"></span>
                 </span>
                 <label  style="padding-left:0; color:#B3B3B3;display:block">邀请奖励(体验金)</label>
             </div>
         </div>
         <div class="row cl">
             <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>体验金收益周期：</label>
             <div class="formControls col-xs-8 col-sm-8">
                 <span style="display:block">
                     <input type="text" class="input-text"  style="width:400px;" value="{{$shop_config['experience_day']}}" placeholder="请输入体验金收益周期" id="experience_day" name="experience_day">天
                     <span display="none" style="color:red"  class="show_info"></span>
                 </span>
                 <label  style="padding-left:0; color:#B3B3B3;display:block">体验金转入零钱包后可以收益的天数</label>
             </div>
         </div>
         <!--<div class="row cl">-->
             <!--<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>收益结算时间点：</label>-->
             <!--<div class="formControls col-xs-8 col-sm-8">-->
                 <!--<span style="display:block">-->
                     <!--<input type="text" value="{{$shop_config['settle_time']}}" name="settle_time" onfocus="WdatePicker({dateFmt:'HH:mm:ss' })" id="settle_time" class="input-text Wdate" style="width:160px;">-->
                     <!--<span display="none" style="color:red"  class="show_info"></span>-->
                 <!--</span>-->
                 <!--<label  style="padding-left:0; color:#B3B3B3;display:block">收益结算时间点，请选择00:00:00-23:59:59中的一个时间点。（功能暂不开放）</label>-->
             <!--</div>-->
         <!--</div>-->
         <div class="row cl">
             <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>投资(预期年化收益率范围)：</label>
             <div class="formControls col-xs-8 col-sm-8">
                 <span style="display:block">
                     <input type="text" class="input-text"  style="width:400px;" value="{{$shop_config['rate_range']}}" placeholder="请输入投资预期年化收益率范围" id="rate_range" name="rate_range">
                     <span display="none" style="color:red"  class="show_info"></span>
                 </span>
                 <label  style="padding-left:0; color:#B3B3B3;display:block">投资预期年化收益率范围(app首页显示，格式为:4.04%-6.93%)</label>
             </div>
         </div>
         <div class="row cl">
             <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>客服电话：</label>
             <div class="formControls col-xs-8 col-sm-8">
                 <span style="display:block">
                     <input type="text" class="input-text"  style="width:400px;" value="{{$shop_config['client_phone']}}" placeholder="请输入客服电话" id="client_phone" name="client_phone">
                     <span display="none" style="color:red"  class="show_info"></span>
                 </span>
                 <label  style="padding-left:0; color:#B3B3B3;display:block">客服电话</label>
             </div>
         </div>

        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <span id="wait_img" style="display:none"><img style="width:31px;" src="__PUBLIC__/default/loading-1.gif"></span>
                <button class="btn btn-warning radius" type="submit" id="submit"><i class="Hui-iconfont">&#xe632;</i> 更新</button>
                <button  class="btn btn-default radius" type="reset">&nbsp;&nbsp;重置&nbsp;&nbsp;</button>
            </div>
        </div>
    </form>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="__EXTEND__/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="__EXTEND__/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="__EXTEND__/static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="__EXTEND__/static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->
<!--/_footer /作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__EXTEND__/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="__EXTEND__/lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="__EXTEND__/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript" src="__EXTEND__/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="__EXTEND__/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>

<script type="text/javascript">
    /*检测价格的格式*/
    function checkPrice(obj,desc,need = 0){
        var check_val = $(obj).val();
        $(obj).parents(".formControls").find(".show_info").css("display","inline-block");
        if(check_val){
            if((/^[0-9]+(.[0-9]{1,2})?$/.test(check_val))){
                $(obj).parents(".formControls").find(".show_info").html("<i class=\"Hui-iconfont\">&#xe6a7;</i>"+desc+":符合条件");
                $(obj).parents(".formControls").find(".show_info").css("color","green");

            }else{
                $(obj).parents(".formControls").find(".show_info").html("<i class=\"Hui-iconfont\">&#xe6a6;</i>"+desc+":请输入整数或精确到小数点后二位");
                $(obj).parents(".formControls").find(".show_info").css("color","red");
            }
        }else{
            if(need == 1){
                $(obj).parents(".formControls").find(".show_info").html("必填");
            }else{
                $(obj).parents(".formControls").find(".show_info").html("");
            }
            $(obj).parents(".formControls").find(".show_info").css("color","red");
        }
    }
    /*提交*/
    $("#form-edit").validate({
        rules: {
        },
        onkeyup: false,
        focusCleanup: true,
        success: "valid",
        submitHandler: function (form) {
            layer.confirm('确认要更新吗？',function(index) {
                $(form).ajaxSubmit({
                    type: 'post',
                    url: "{{:U('Admin/System/update_config')}}",
                    beforeSend: function () {
                        $('#submit').hide();
                        $('#wait_img').show();
                    },
                    success: function (data) {
                        if (data.status) {
                            $('#submit').remove();
                            layer.msg(data.info, {icon: 6, time: 1000});
                            setTimeout((function () {
                                $("form")[0].reset();
                                window.location.href = "{{:U('Admin/System/config')}}";
                            }), 1500);
                        } else {
                            $('#wait_img').hide();
                            $('#submit').show();
                            layer.msg(data.info, {icon: 2, time: 1000});
                        }
                    },
                    error: function (XmlHttpRequest, textStatus, errorThrown) {
                        layer.msg('error!', {icon: 5, time: 1000});
                    }
                });
            });
        }
    });
     $("#sub1").click(function(e){
         e.preventDefault();
         /*检验参数*/
         var experience_money = $("#experience_money").val();
         if(experience_money == ''){
             layer.msg('请输入注册奖励(体验金)',{icon:2,time:1000});
             return false;
         }

         layer.confirm('确认要更新吗？',function(index){
             $.ajax({
                 type: 'POST',
                 url: '{{:U("Admin/System/update_config")}}',
                 data: {
                     experience_money:experience_money,
                     index_goods_number:index_goods_number,
                     video_goods_number:video_goods_number,
                     page_number:page_number,
                     sign_number:sign_number,
                     sign_award:sign_award,
                     lowest_price:lowest_price,
                     drawings:drawings,
                     deduction:deduction,
                     hotgoods_award:hotgoods_award,
                 },
                 dataType: 'json',
                 success: function(data){
                     if(data.status){
                         layer.msg(data.info,{icon:1,time:1000});
                         setTimeout((function() {
//                            window.location.href='{{:U("Admin/System/config")}}';
                         }), 1000);
                     }else{
                         layer.msg(data.info,{icon:2,time:1000});
                     }

                 },
                 error:function(data) {
                     console.log(data.msg);
                 },
             });
         });
    })
</script>
</body>
</html>